<!DOCTYPE html>
<html lang="zh-cn">
	<head>
	    <meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1">
	    <#include "/common/meta.ftl"/>
	    <#include "/common/form.ftl"/>
		<script>
			$(function(){
				$("#form").validate({
					rules: {
						userName: {required:true,maxlength:32},
						userEmail: {required:true,email:true}
					},
					errorElement: "div",
					errorPlacement: function(error, element) {
						error.appendTo($(element).parent());
						$(element).parent().addClass("has-error");
						$(error).addClass("help-block alert-danger");
					},
					success: function(label) {
						$(label).parent().removeClass("has-error");
						$(label).remove();
					}
				})
			});
		
			function saveMyinfo(){
	            $('#form').ajaxSubmit({
					beforeSubmit : function(a,f,o) {
						return $("#form").valid();
					},
					success : function(data) { // data 保存提交后返回的数据，一般为 json 数据
		                var msg = new top.$.zui.Messager('提示消息：个人信息保存成功！', {
		                	type : 'success',
		                	fade : true,
		                	//placement : 'bottom-right',
		                	icon : 'ok-sign',
		                	time : 3000,
		                	scale : true
		                });
		                msg.show();
		            }
				}); 
			}
		</script>
	</head>
	<body style="padding:5px;">
		<div class="panel panel-primary">
			<div class="panel-heading" style="">
				<strong>
				<i class="icon-user"></i>
				编辑个人信息
				</strong>
			</div>
			<div class="panel-body" style="padding:5px;padding-top:15px;">
			<form id="form" class="form-horizontal" role="form" method='post' action="./myInfoSave">
				<input type="hidden" name="userID" value="${user.userID}"/>
		    	<div class="form-group">
          			<label class="col-md-2 control-label required" for="userLoginName">登录名</label>
	          		<div class="col-md-3 ">
	             		<input type='text' readOnly value='${user.userLoginName!''}' class='form-control' placeholder=''/>
	          		</div>
        		</div>
        		<div class="form-group">
          			<label class="col-md-1 col-md-offset-1 control-label required" >用户名</label>
	          		<div class="col-md-3">
	             		<input type='text' name='userName' id='userName' value='${user.userName!''}' class='form-control' placeholder=''/>
	          		</div>
        		</div>
        		<div class="form-group">
          			<label class="col-md-1 col-md-offset-1 control-label required" >性别</label>
	          		<div class="col-md-1">
	             		<select name='userSex' id='userSex' class='form-control'>
			            	<option value="1" <#if (user.userSex!'')==1>selected</#if>>男</option>
							<option value="2" <#if (user.userSex!'')==2>selected</#if>>女</option>
			            </select>
	          		</div>
        		</div>
        		<div class="form-group">
          			<label class="col-md-1 col-md-offset-1 control-label required" >出生日期</label>
	          		<div class="col-md-3">
	             		<input onClick="WdatePicker({readOnly:true})" type='text' name='userBirthday' id='userBirthday' value='${user.userBirthday!''}' class='form-control Wdate' placeholder=''/>
	          		</div>
        		</div>
        		<div class="form-group">
          			<label class="col-md-1 col-md-offset-1 control-label" for="userEmail">电子邮箱</label>
	          		<div class="col-md-3">
	             		<input type='text' name='userEmail' id='userEmail' value='${user.userEmail!''}' class='form-control' placeholder=''/>
	          		</div>
        		</div>
        		<div class="form-group">
          			<label class="col-md-1 col-md-offset-1 control-label" >联系电话</label>
	          		<div class="col-md-3">
	             		<input type='text' name='userMobile' id='userMobile' value='${user.userMobile!''}' class='form-control' placeholder=''/>
	          		</div>
        		</div>
        		<div class="form-group">
          			<label class="col-md-1 col-md-offset-1 control-label" >地址</label>
	          		<div class="col-md-5">
	             		<input type='text' name='userAddress' id='userAddress' value='${user.userAddress!''}' class='form-control' placeholder=''/> 
	          		</div>
        		</div>
        		<div class="form-group">
          <div class="col-md-offset-2 col-md-10">
          	<button class="btn btn-primary" onclick="saveMyinfo();" type="button"><i class="icon icon-save"></i> 保存</button>
          </div>
        </div>
        		</form>
		  	</div>
		</div>
	</body>
</html>